<template>
    <el-tree :data="data"
             :props="defaultProps"
             empty-text="空"
             :highlight-current="true"
             :current-node-key="'33'"
             @node-click="handleNodeClick"
             default-expand-all
             @check-change="handleCheckChange"
    ></el-tree>
</template>

<script>
    export default {
        data() {
            return {
                data: [{
                    id: '1',
                    label: '一级 1',
                    children: [{
                        id: '11',
                        label: '二级 1-1',
                        children: [{
                            id: '111',
                            label: '三级 1-1-1'
                        }]
                    }]
                }, {
                    id: '2',
                    label: '一级 2',
                    children: [{
                        id: '22',
                        label: '二级 2-1',
                        children: [{
                            id: '222',
                            label: '三级 2-1-1'
                        }]
                    }, {
                        id: '3',
                        label: '二级 2-2',
                        children: [{
                            id: '33',
                            label: '三级 2-2-1'
                        }]
                    }]
                }, {
                    id: '4',
                    label: '一级 3',
                    children: [{
                        id: '44',
                        label: '二级 3-1',
                        children: [{
                            id: '444',
                            label: '三级 3-1-1'
                        }]
                    }, {
                        id: '5',
                        label: '二级 3-2',
                        children: [{
                            id: '55',
                            label: '三级 3-2-1'
                        }]
                    }]
                }],
                defaultProps: {
                    children: 'children',
                    label: 'label'
                }
            };
        },
        methods: {
            handleCheckChange(data, checked, indeterminate) {
                console.log(data, checked, indeterminate);
            },
            handleNodeClick(data) {
                console.log(data,'+');
            },
        }
    };
</script>

<style scoped>

</style>